package com.ws.shop.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.ws.shop.bean.Page;
import com.ws.shop.dao.ExpressDao;
import com.ws.shop.entity.Express;
import com.ws.shop.service.ExpressService;

@Service(value="expressService")
public class ExpressServiceImpl implements ExpressService {
	@Resource(name="expressDao")
	private ExpressDao expressDao;
	
	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public Page findExpressListPage(long pageno,int pagesize, String name, String start,
			String end) {
		return expressDao.findExpressListPage(pageno,pagesize,name,start,end);
	}

	@Transactional(rollbackFor=Exception.class)
	public void deleteExpressById(int id) {
		expressDao.deleteExpressById(id);
	}

	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public Express findExpressById(int id) {
		return expressDao.findExpressById(id);
	}

	@Transactional(rollbackFor=Exception.class)
	public void saveOrUpdateExpress(Express express) {
		expressDao.saveOrUpdateExpress(express);
	}
	
	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public void findExpress(final Page page){
		expressDao.findExpress(page);
	}

	public List<Map<String,Object>> getExpressByAid(long aid){
		return expressDao.getExpressByAid(aid);
	}
}
